<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>挂号</title>
  <!-- Bootstrap -->
  <link href="../static/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link href="../static/css/font-awesome.min.css" rel="stylesheet">
  <!-- NProgress -->
  <link href="../static/css/nprogress.css" rel="stylesheet">
  <!-- iCheck -->
  <link href="../static/css/green.css" rel="stylesheet">
  <!-- bootstrap-progressbar -->
  <link href="../static/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
  <!-- JQVMap -->
  <link href="../static/css/jqvmap.min.css" rel="stylesheet" />
  <link href="../static/css/dropzone.min.css" rel="stylesheet">
  <!-- Custom Theme Style -->
  <link href="../static/css/custom.min.css"	rel="stylesheet">

  <!-- add localcss 2016-8-18 -->
  <link href='../static/localcss/appinfoadd.css' rel='stylesheet'>
  <link href='../static/localcss/appinfolist.css' rel='stylesheet'>
</head>
<body class="nav-md footer_fixed">
<div class="container body">
  <div class="main_container">
    <div class="col-md-3 left_col menu_fixed">
      <div class="left_col scroll-view">
        <div class="navbar nav_title" style="border: 0;">
          <a href="#" class="site_title"><i class="fa fa-paw"></i> <span>APP
								BMS</span>
          </a>
        </div>

        <div class="clearfix"></div>

        <!-- menu profile quick info -->
        <div class="profile">
          <div class="profile_pic">
            <img
                    src="../static/images/img.jpg"
                    alt="..." class="img-circle profile_img">
          </div>
          <div class="profile_info">
            <h2><span th:text="${session.user.userName}"></span></h2>
          </div>
        </div>
        <!-- /menu profile quick info -->

        <br />

        <!-- sidebar menu -->
        <div id="sidebar-menu"
             class="main_menu_side hidden-print main_menu">
          <div class="menu_section">
            <h3><span th:text="${session.user.userName}"></span></h3>
            <ul class="nav side-menu">
              <li><a><i class="fa fa-home"></i> 挂号管理 <span
                      class="fa fa-chevron-down"></span>
              </a>
                <ul class="nav child_menu">
                  <li><a href="/registry/toRegistry">创建就诊卡</a></li>
                  <li><a href="/registry/toAddRegistry">门诊挂号</a></li>
                  <li><a href="/registry/toSelectAll">挂号信息</a></li>
                </ul></li>
            </ul>
          </div>


        </div>
        <!-- /sidebar menu -->

        <!-- /menu footer buttons -->
        <div class="sidebar-footer hidden-small">
          <a data-toggle="tooltip" data-placement="top" title="Settings">
            <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
          </a> <a data-toggle="tooltip" data-placement="top" title="FullScreen">
          <span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>
        </a> <a data-toggle="tooltip" data-placement="top" title="Lock"> <span
                class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>
        </a> <a data-toggle="tooltip" data-placement="top" title="Logout"
                href="${pageContext.request.contextPath }/dev/logout"> <span
                class="glyphicon glyphicon-off" aria-hidden="true"></span> </a>
        </div>
        <!-- /menu footer buttons -->
      </div>
    </div>

    <!-- top navigation -->
    <div class="top_nav">
      <div class="nav_menu">
        <nav>
          <div class="nav toggle">
            <a id="menu_toggle"><i class="fa fa-bars"></i>
            </a>
          </div>

          <ul class="nav navbar-nav navbar-right">
            <li class=""><a href="javascript:;"
                            class="user-profile dropdown-toggle" data-toggle="dropdown"
                            aria-expanded="false"> <img
                    src="../static/images/img.jpg"
                    alt=""><span th:text="${session.user.userName}"></span> <span
                    class=" fa fa-angle-down"></span> </a>
              <ul class="dropdown-menu dropdown-usermenu pull-right">
                <li><a
                        href="/sysUser/exit"><i
                        class="fa fa-sign-out pull-right"></i> Log Out</a>
                </li>
              </ul></li>

            <li role="presentation" class="dropdown">

              <ul id="menu1" class="dropdown-menu list-unstyled msg_list"
                  role="menu">
                <li><a> <span class="image"><img
                        src="../static/images/img.jpg"
                        alt="Profile Image" />
										</span> <span> <span>John Smith</span> <span class="time">3
													mins ago</span> </span> <span class="message"> Film festivals used
												to be do-or-die moments for movie makers. They were where...
										</span> </a></li>
                <li><a> <span class="image"><img
                        src="../static/images/img.jpg"
                        alt="Profile Image" />
										</span> <span> <span>John Smith</span> <span class="time">3
													mins ago</span> </span> <span class="message"> Film festivals used
												to be do-or-die moments for movie makers. They were where...
										</span> </a></li>
                <li><a> <span class="image"><img
                        src="../static/images/img.jpg"
                        alt="Profile Image" />
										</span> <span> <span>John Smith</span> <span class="time">3
													mins ago</span> </span> <span class="message"> Film festivals used
												to be do-or-die moments for movie makers. They were where...
										</span> </a></li>
                <li><a> <span class="image"><img
                        src="../static/images/img.jpg"
                        alt="Profile Image" />
										</span> <span> <span>John Smith</span> <span class="time">3
													mins ago</span> </span> <span class="message"> Film festivals used
												to be do-or-die moments for movie makers. They were where...
										</span> </a></li>
                <li>
                  <div class="text-center">
                    <a> <strong>See All Alerts</strong> <i
                            class="fa fa-angle-right"></i> </a>
                  </div></li>
              </ul></li>
          </ul>
        </nav>
      </div>
    </div>
    <!-- /top navigation -->
    <div class="right_col" role="main">
      <div class="">
        <div class="clearfix"></div>
        <div class="row">
          <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
              <div class="x_title">
                <h2>挂号</h2>
                <div class="clearfix"></div>
              </div>
              <div class="x_content">

                <div class="clearfix"></div>
                <form class="form-horizontal form-label-left" action="/registry/addRegistry" method="post">
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">身份证号 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <input class="form-control col-md-7 col-xs-12"
                             data-validate-length-range="20" data-validate-words="1" name="idCard"  required="required"
                             type="text">
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">病人姓名 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <input type="hidden" name="patientId">
                      <input class="form-control col-md-7 col-xs-12"
                             data-validate-length-range="20" data-validate-words="1" name="name"  required="required"
                             type="text" readonly="readonly">
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">手机号 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <input class="form-control col-md-7 col-xs-12"
                             data-validate-length-range="20" data-validate-words="1" name="phone"   required="required"
                             type="text" readonly="readonly">
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">出生日期 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <input type="text" name="birthday"   readonly="true"
                             data-validate-minmax="10,500"  class="form-control col-md-7 col-xs-12">
                    </div>
                  </div>

                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">性别 <span class="required">*</span></label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <select name="sex" type="text" id="flatformId" class="form-control"   readonly="readonly" disabled>
                        <option value="0"></option>
                        <option value="1">男</option>
                        <option value="2">女</option>
                      </select>
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">家庭住址 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <input id="supportROM" class="form-control col-md-7 col-xs-12" name="address"
                             data-validate-length-range="20" data-validate-words="1"   required="required"
                             type="text" readonly="readonly">
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">就诊科室 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <select name="departmentId" class="form-control">
                        <option value="0">--请选择--</option>
                        <option th:each="list:${departmentList}" th:value="${list.id}" th:text="${list.name}"></option>
                      </select>
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">时间段 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <select name="sign" class="form-control">
                        <option value="0">--请选择--</option>
                        <option value="1">上午</option>
                        <option value="2">下午</option>
                      </select>
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">问诊医师 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
<!--                      医生排期表id-->
                      <input type="hidden" name="scheduleId">
                      <select name="userId" class="form-control">
                        <option value="0">--请先选择时间段和就诊科室--</option>
                      </select>
                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">就诊房间 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <select name="roomId">
                        <option value="0" selected></option>
                        <option th:value="${roomList.id}" th:each="roomList:${roomList}" th:text="${roomList.name}"></option>
                      </select>

                    </div>
                  </div>
                  <div class="item form-group">
                    <label class="control-label col-md-3 col-sm-3 col-xs-12">是否使用医保 <span class="required">*</span>
                    </label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                      <input type="hidden" name="isMedicare" value="1">
                      <button type="button" class="btn btn-success" onclick="useMedicare()">是</button>
                      <button type="button" class="btn btn-primary" onclick="notUsedMedicare()">否</button>
                    </div>
                  </div>
<!--                  是否使用医保卡信息-->
                  <div name="MedicareInfo" style="display: none">
                    <input type="hidden" name="isMedicare">
                    <div class="item form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12">医保卡号 <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="text" name="idMedicare" readonly="readonly" class="form-control">
                      </div>
                    </div>
                    <div class="item form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12">挂号总金额 <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="text" name="fee" readonly="readonly" class="form-control">
                      </div>
                    </div>
                    <div class="item form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12">医保报销额 <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="text" name="medicareFee" readonly="readonly" class="form-control">
                      </div>
                    </div>
                    <div class="item form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12">实际应支付 <span class="required">*</span>
                      </label>
                      <div class="col-md-6 col-sm-6 col-xs-12">
                        <input type="text" name="payFee" readonly="readonly" class="form-control">
                      </div>
                    </div>
                  </div>

                  <div class="ln_solid"></div>
                  <div class="form-group">
                    <div class="col-md-6 col-md-offset-3">
                      <button id="send" type="submit" class="btn btn-success">保存</button>
                      <button type="button" class="btn btn-primary" id="back" onclick="history.back()">返回</button>
                      <br/><br/>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>
    <!-- /page content -->
    <!-- footer content -->
    <footer>
      <div class="pull-right">©2016 All Rights Reserved.</div>
      <div class="clearfix"></div>
    </footer>
    <!-- /footer content -->
  </div>
</div>
<!-- jQuery -->
<script src="../static/js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../static/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="../static/js/fastclick.js"></script>
<!-- NProgress -->
<script src="../static/js/nprogress.js"></script>
<!-- jQuery custom content scroller -->
<script src="../static/js/jquery.mCustomScrollbar.concat.min.js"></script>
<!-- Custom Theme Scripts -->
<script src="../static/js/custom.min.js"></script>
<!-- validator -->
<%--     <script src="../static/js/validator.js"></script> --%>
<!-- dropzone -->
<script src="../static/js/dropzone.js"></script>
<script src="../static/js/jquery-3.6.0.js"></script>
<script>
      $("[name=idCard]").blur(function(){
        $.getJSON("/patient/getPatientByIdCard",{
          "idCard":$("[name=idCard]").val()
        },function(data){
          if(data==null){
            alert("就诊卡查询失败，请先创建就诊卡！！")
            $("[name=name]").val("")
            $("[name=phone]").val("")
            $("[name=birthday]").val("")
            $("[name=sex]").val("")
            $("[name=address]").val("")
          }else{
            $("[name=name]").val(data.name)
            $("[name=phone]").val(data.phone)
            $("[name=birthday]").val(data.birthday)
            $("[name=sex]").val(data.sex)
            $("[name=address]").val(data.address)
            $("[name=idMedicare]").val(data.idMedicare)
            $("[name=patientId]").val(data.id)
          }
        })
      })
      $("[name=sign]").blur(function(){
        if($("[name=departmentId]").val()!=null && $(this).val() != null){
          $.getJSON("/Schedule/getDoctorInfo",{
            "departmentId":$("[name=departmentId]").val(),
            "sign":$("[name=sign]").val()
          },function(data){
            $("[name=userId]").html("<option value='0'>请选择</option>");
            for (var i = 0; i < data.length; i++) {
                $("[name=userId]").append("<option value='"+data[i].id+"'>"+data[i].userName+"</option>")
            }
          })
        }
      })
      $("[name=userId]").change(function(){
        $.getJSON("/Schedule/getScheduleId",{
          "userId":$(this).val()
        },function(data){
          $("[name=ScheduleId]").val(data.id)
        })
            $.getJSON("/Schedule/getRoomInfo",{
              "userId":$(this).val(),
              "departmentId":$("[name=departmentId]").val(),
              "sign":$("[name=sign]").val()
            },function(data){
              $("[name=roomId]").val(data.id);
            })
      })
      //使用医保卡
      function useMedicare(){
        $("[name=isMedicare]").val(2)
        $("[name=MedicareInfo]").show()
        $("[name=fee]").val(50)
        $("[name=medicareFee]").val(10)
        $("[name=payFee]").val(40)
      }
      //不使用医保卡
      function notUsedMedicare(){
        $("[name=isMedicare]").val(1)
        $("[name=MedicareInfo]").show()
        $("[name=pay]").val(50)
        $("[name=medicareFee]").val(0)
        $("[name=payFee]").val(50)
      }
</script>
</body>
</html>